<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="org.apak.model.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Service request</title>
</head>
<body>
<a href="./serviceRequestMenu">...to service request menu</a>
	<% 
		Boolean cancel = (Boolean) request.getAttribute("cancel");
		ServiceRequest serviceRequest = (ServiceRequest) request.getAttribute("serviceRequest");
		String success = (String) request.getAttribute("success");
		if(success == null)
			success = "";
		if(serviceRequest != null) {
	%>
<form action="serviceRequest" method="post">
	<%= serviceRequest.getCustomerName() %>
	<input type="submit" name="actionButton" value="Search customer"/>
	<table>
		<tr>
			<td>Status</td>
			<td>
			<%
				if(serviceRequest.getService_request_status_typeName() != null) {
			%>
				<input type="text" name="status" value="<%= serviceRequest.getService_request_status_typeName()%>" readonly>
			<%
				}
			 %>
				
			</td>
		</tr>
		<tr>
			<td>Clients description</td>
			<td>
				<textarea name="clientsDescription"><%= serviceRequest.getService_desc_by_customer()%></textarea>
			</td>
		</tr>
		<tr>
			<td>Workers description</td>
			<td>
				<textarea name="employeeDescription"><%= serviceRequest.getService_desc_by_employee()%></textarea>
			</td>
		</tr>
		<tr>
			<td>
				<input type="submit" name="actionButton" value="Save request"/>	
			</td>
			<td>
				<input type="submit" name="actionButton" value="Form order"/>
			</td>
			<td>
			<%
				if(cancel != null)
					if(cancel){
			%>
				<input type="submit" name="actionButton" value="Cancel request"/>
			<%
					}
			%>
			</td>
			<td>
				<%=success %>
			</td>
		</tr>
	</table>
</form>
	<%
		} else {
	%>
	<form action="serviceRequest" method="post">
		SELECT CUSTOMER!
		<input type="submit" name="actionButton" value="Search customer"/>

	<table>
		<tr>
			<td>Clients description</td>
			<td>
				<textarea name="clientsDescription" disabled="disabled"></textarea>
			</td>
		</tr>
		<tr>
			<td>Workers description</td>
			<td>
				<textarea name="workersDescription" disabled="disabled"></textarea>
			</td>
		</tr>
		<tr>
			<td>		
				<input type="submit" name="actionButton" value="Save request" disabled="disabled"/>		
			</td>
			<td>
				<input type="submit" name="actionButton" value="Form order" disabled="disabled"/>
			</td>
			<td>
			<%
				if(cancel != null)
					if(cancel){
			%>
				<input type="submit" name="actionButton" value="Cancel request"/>
			<%
					}
			%>
			</td>
		</tr>
		<%
			}
		%>
	</table>	
</form>
</body>
</html>